/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.squirrelm.my.dao.impl;

import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.squirrelm.my.PersistenceManagerHolder;
import org.squirrelm.my.dao.MyDao;
import org.squirrelm.my.domain.My;

/**
 *
 * @author 松鼠M
 */
@Repository
public class MyDaoImpl implements MyDao {

    private final PersistenceManagerHolder ppx;

    @Autowired
    public MyDaoImpl(PersistenceManagerHolder ppx)
    {
        this.ppx    = ppx;
    }

    private DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();

    public void create(My my) {
        ppx.get().makePersistent(my);
    }

    public My get(Long myID) {
        return ppx.get().getObjectById(My.class, myID);
    }

}
